<!DOCTYPE HTML>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-redWelfareBag-add">
	        <div class="form-group">
            <label class="col-sm-3 control-label">开始时间：</label>
            <div class="col-sm-8">
                <input id="iStartTime" class="form-control time-input" name="beginTime" type="text">
            </div>
        </div>
		        <div class="form-group">
            <label class="col-sm-3 control-label">结束时间：</label>
            <div class="col-sm-8">
                <input id="iEndTime" class="form-control time-input" name="endTime" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">红包数量：</label>
            <div class="col-sm-8">
                <input id="bagNum" name="bagNum" class="form-control" maxlength="6" onkeyup="appValid.regNumber(this)" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">红包金额：</label>
            <div class="col-sm-8">
                <input id="bagMoney" name="bagMoney" class="form-control" maxlength="8" onkeyup="appValid.regNumber(this)" type="text">
            </div>
        </div>

		</form>
	</div>
    <div th:include="include::footer"></div>
    <script type="text/javascript">
		var prefix = ctx + "module/redWelfareBag"
		$("#form-redWelfareBag-add").validate({
			rules:{
				xxxx:{
					required:true,
				},
			}
		});
		
		function submitHandler() {
	        if ($.validate.form()) {
	            $.operate.save(prefix + "/add", $('#form-redWelfareBag-add').serialize());
	        }
	    }

	    $(function(){

            layui.use('laydate', function() {
                var laydate = layui.laydate;
                var startDate = laydate.render({
                    elem: '#iStartTime',
                    type: 'datetime',
                    theme: 'molv',
                    trigger: 'click'
                });
                var endDate = laydate.render({
                    elem: '#iEndTime',
                    type: 'datetime',
                    theme: 'molv',
                    trigger: 'click'
                });
            });

        });

        var appValid = new Object();

        appValid.regNumber = function (obj) {
            obj.value = obj.value.replace(/[^0-9]/g,'');
        }


    </script>
</body>
</html>
